/*
 * Scheduler.h File
 * 
 * 
 * 
 */
 
#ifndef SCHEDULER_H
#define SCHEDULER_H
 
#include "scheduler.h"
#include "process.h"
 
typedef struct S
{
	// an array of void pointers, no type
	ProcessPtr* array;								// array of processes.
	int max; 										// max number of processes
	int count; 										// current number of processes
	int head; 										// head of the queue
	int tail; 										// tail of the queue
	int queueCount;   								// count the number of processes in the blocked queues
	// Blocked Process queues
	ProcessPtr io; 		// io blocked queue
	ProcessPtr mutex;   // mutex blocked queue
	ProcessPtr cond;	// condition var queue
	ProcessPtr idle;    // idle process
	
	// scheduler Member funtions
	int (*destruct)(struct S*);				   		// destruct this
	int (*addProcess)(struct S*, ProcessPtr);       // adds a process to scheduling list.
	ProcessPtr (*nextProcess)(struct S*, int*);		// get the next process
	ProcessPtr (*proc_Interrupt)(struct S*, int, int, int*); // Gets the proc associated with the interrupt
	int (*maxProcess)(struct S*);                   // get the max # of elements the this can contain.
	int (*processCount)(struct S*);                 // gets the number of elements
	char* (*toString)(struct S*, int*);				// tostring
	char* (*toStringQueues)(struct S*, int*);		// tostring for the blocked queues
} Scheduler;

typedef Scheduler* SchedulerPtr;

SchedulerPtr SchedulerConstruct(int size, int select_type, int store_type); // construct new Scheduler

#endif
 